package com.xiaoma.demo.controller;

import com.xiaoma.demo.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description:
 *
 * @author: kaixiang Zhao
 * @date: 2020-10-07 19:22
 */

@RestController
@RequestMapping("zkx/aa/bbb")
public class TeacherController {

    @Autowired
    private TeacherService teacherService;

    /**
     * @Description: 做一个获取全量的数据List
     *
     * @return:
     * @auther: Kaixiang Zhao
     * @date: 2020-10-07 19:36
     */
    @GetMapping("/testList")
    public ResponseEntity testList(){
        return ResponseEntity.ok(teacherService.testList());
    }

    @DeleteMapping("deleteById")
    public ResponseEntity.BodyBuilder deleteById(Integer id){
        teacherService.deleteById(id);
        return ResponseEntity.ok();
    }


    /**
     * 规范：
     *      查询 @GetMapping
     *      插入 @PostMapping
     *      更新 @PutMapping
     *      删除 @DeleteMapping
     */

    public ResponseEntity updateTesacher(){
        System.out.println("你好呀");
        return ResponseEntity.ok(null);
    }

}
